package com.xiashitech.apiservice.service.impl;

import com.xiashitech.apiservice.dao.PushHistoryMapper;
import com.xiashitech.apiservice.dao.model.AgentNode;
import com.xiashitech.apiservice.dao.model.PushHistory;
import com.xiashitech.apiservice.service.IPushHistroyService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
@RequiredArgsConstructor(onConstructor = @_(@Autowired))
public class PushHistoryServiceImpl implements IPushHistroyService {

    private final PushHistoryMapper pushHistoryMapper;

    @Override
    public void insertPushHistroy(PushHistory history) {
         pushHistoryMapper.insertPushHistory(history);
    }
    @Override
    public int updatePushStatus(List<Long> ids, Integer status) {

        return 0;
    }

    @Override
    public int updateOnePushStatus(Long id, Integer status) {

        return pushHistoryMapper.updateOnePushStatus(id,status);
    }

    @Override
    public PushHistory selectOneHistory(Long id) {
        PushHistory pushHistory = pushHistoryMapper.selectOneHistory(id);
        return pushHistory;
    }

    @Override
    public int deleteHistory() {
        return pushHistoryMapper.deleteHistory();
    }

    @Override
    public List<PushHistory> selectRetryHistory(PushHistory pushHistory) {
        return pushHistoryMapper.selectRetryHistory(pushHistory);
    }

    @Override
    public List<PushHistory> getHistoryStatusListByIds(List<Integer> ids) {
        if(ids==null || ids.size()==0)
        {
            return new ArrayList<>();
        }
        return pushHistoryMapper.getHistoryStatusListByIds(ids);
    }

    @Override
    public List<PushHistory> getHistoryStatusListBySystemIds(List<String> systemIds) {
      //System.out.println("###getHistoryStatusListBySystemIds "+systemIds);
       if(systemIds==null || systemIds.size()==0)
       {
           System.out.println("###getHistoryStatusListBySystemIds 001");
           return new ArrayList<>();
       }
        System.out.println("###getHistoryStatusListBySystemIds 002");
        return pushHistoryMapper.getHistoryStatusListBySystemIds(systemIds);
    }
}
